﻿<div ng-controller="transferController">
	<div class="wrapper border-bottom white-bg page-heading">
		<div class="col-lg-pull-12">
			<ol class="breadcrumb">
				<li>提现</li>
			</ol>
		</div>
	</div>
	<form class="form-horizontal row">
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">商户号</label>
				<div class="col-sm-8">
					<input name="merchant_no" type="text" class="form-control input-sm" ng-model="query.merchant_no">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">手机号</label>
				<div class="col-sm-8">
					<input name="mobile" type="text" class="form-control input-sm" ng-model="query.mobile">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">姓名</label>
				<div class="col-sm-8">
					<input name="name" type="text" class="form-control input-sm" ng-model="query.name">
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">单号/流水号</label>
				<div class="col-sm-8">
					<input name="order_no" type="text" class="form-control input-sm" ng-model="query.order_no">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">OEM商户</label>
				<div class="col-sm-8">
					<ui-select ng-model="query.merchant_id" theme="bootstrap">
						<ui-select-match placeholder="选择OEM商户">{{$select.selected.name}}</ui-select-match>
						<ui-select-choices repeat="item.id as item in oems | propsFilter: {name: $select.search}">
							<span ng-bind="item.name"></span>
						</ui-select-choices>
					</ui-select>
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">状态</label>
				<div class="col-sm-8">
					<select class="form-control input-sm" ng-model="query.status">
						<option value="">全部</option>
						<option value="1">提现申请</option>
						<option value="2">完成</option>
						<option value="3">转账中</option>
						<option value="4">失败</option>
						<option value="5">不确定</option>
						<option value="6">取消</option>
					</select>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">通道</label>
				<div class="col-sm-8">
					<select class="form-control input-sm" ng-model="query.pay_channel">
						<option value="0">全部</option>
						<option value="1">HF</option>
						<option value="7">CHPAY</option>
					</select>
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">申请时间</label>
				<div class="col-sm-8">
					<div date class="input-group date">
						<input class="form-control input-sm" ng-model="query.start_time">
						<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="col-sm-8">
					<div date class="input-group date">
						<input class="form-control input-sm" ng-model="query.end_time">
						<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-5">
				<div class="col-sm-offset-3 col-sm-12">
					<a class="btn btn-primary btn-sm" ui-sref="app.finance.transfer(query)"><i class="fa fa-search"></i> 查询</a>
					<a class="btn btn-primary btn-sm" ng-click="search()"><i class="fa fa-refresh"></i> 刷新</a>
					<button class="btn btn-primary btn-sm" ng-click="apply_batch()" btn-loading="psdisabled" loading-text="处理中..." ng-disabled="psdisabled"><i class="fa fa-credit-card"></i> 批量提现</button>
					<button class="btn btn-primary btn-sm" ng-click="get_balance()" btn-loading="psdisabled" loading-text="处理中..." ng-disabled="psdisabled"><i class="fa fa-database"></i> 当前余额</button>
				</div>
			</div>
			<div class="col-sm-7">
				<div class="col-sm-12">
					<div class="form-control-static text-right">申请提现（截止昨天）：{{model.transfer_amount}} 总额度：{{model.channel_total}} 当前余额：{{model.balance}}</div>
				</div>
			</div>
		</div>
	</form>
	<table class="table table-hover m-t-md">
		<thead>
			<tr style="background-color: #f7f7f9;">
				<th>单号</th>
				<th>时间</th>
				<th>商户</th>
				<th>O商</th>
				<th>状态</th>
				<th>提现金额</th>
				<th>结算费</th>
				<th>实收金额</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody ng-repeat="item in model.rows">
			<tr ng-dblclick="item.show=!item.show">
				<td>{{item.order_no}}</td>
				<td>{{item.apply_time}}</td>
				<td>{{item.binder.name}}</td>
				<td>{{item.merchant.name}}</td>
				<td>{{get_status_name(item.status)}}</td>
				<td>{{item.transfer_amount}}</td>
				<td>{{item.settle_amount}}</td>
				<td>{{item.amount}}</td>
				<td width="{{item.status>2&& item.status<6?'210':'80'}}">
					<a class="btn btn-primary btn-xs" ng-click="item.show=!item.show"><i class="fa fa-cog"></i> 详情</a>
					<button class="btn btn-primary btn-xs" ng-click="transfer_first(item)" btn-loading="psdisabled" ng-if="item.status>2&& item.status<6"
							loading-text="处理中..." ng-disabled="psdisabled">
						<i class="fa fa-search"></i> 查询
					</button>
					<button class="btn btn-primary btn-xs" ng-click="payoff(item)" btn-loading="psdisabled" ng-if="item.status>2&& item.status<6"
							loading-text="处理中..." ng-disabled="psdisabled">
						<i class="fa fa-credit-card"></i> 下发
					</button>
					<!--<button class="btn btn-primary btn-xs" ng-click="cancel(item)" btn-loading="psdisabled" ng-if="item.status==4"
							loading-text="处理中..." ng-disabled="psdisabled">
						<i class="fa fa-credit-card"></i> 取消
					</button>-->
				</td>
			</tr>
			<tr ng-show="item.show">
				<td colspan="8">
					<p>通道：{{item.pay_info.pay_channel}} 开户银行:{{item.bank_name}} 姓名:{{item.account_name}} 卡号:{{item.account_no}} 身份证:{{item.id_card}} </p>
					<p ng-if="item.fail!=''&&item.fail!=null">原因：{{item.fail}}</p>
					<p>异步通知：{{item.notify}}</p>
				</td>
			</tr>
		</tbody>
	</table>
	<div class="row">
		<div class="col-md-12">
			<uib-pagination total-items="model.total_result" items-per-page="model.size" ng-model="model.page" num-pages="model.total_pages"
							ng-change="search_page(model.page)" class="pagination-sm" boundary-links="true" boundary-link-numbers="true" max-size="20"
							previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
			<span class="pull-right" style="margin: 30px 0px 20px 0px">共{{model.total_result}} 当前：{{model.page}}/{{model.total_pages}}</span>
		</div>
	</div>
</div>
